package com.feeyin.radar.listener;

import com.feeyin.radar.sys.dao.OnlineUserDAO;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

public class SystemInitListener
  implements ServletContextListener
{
  public void contextDestroyed(ServletContextEvent arg0)
  {
  }

  public void contextInitialized(ServletContextEvent arg0)
  {
    ApplicationContext applicationContext = WebApplicationContextUtils.getWebApplicationContext(arg0.getServletContext());

    OnlineUserDAO onlineUserDAO = (OnlineUserDAO)applicationContext.getBean("onlineUserDAO");
    onlineUserDAO.deleteAllOnlineUser();
  }
}